home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_netpbm.idb / usr / freeware / catman / p_man / cat3 / libpgm.Z / libpgm
Encoding:
Text File  |  1998-10-28  |  4.6 KB  |  134 lines

  1. /xlv1/freeware/1998.Oct/netpbm/1mar1994/netpbm.diffbuild/pgm
  2.  
  3.  
  4.  
  5.      lllliiiibbbbppppggggmmmm((((3333))))               UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV             lllliiiibbbbppppggggmmmm((((3333))))
  6.  
  7.  
  8.  
  9.      NNNNAAAAMMMMEEEE
  10.       libpgm - functions to    support    portable graymap programs
  11.  
  12.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.       #include <pgm.h>
  14.       cc ... libpgm.a libpbm.a
  15.  
  16.  
  17.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.     TTTTYYYYPPPPEEEESSSS AAAANNNNDDDD CCCCOOOONNNNSSSSTTTTAAAANNNNTTTTSSSS
  19.       typedef ... gray;
  20.       #define PGM_MAXMAXVAL    ...
  21.       extern gray pgm_pbmmaxval;
  22.  
  23.       Each ggggrrrraaaayyyy should contain only    the values between 0000 and
  24.       PPPPGGGGMMMM____MMMMAAAAXXXXMMMMAAAAXXXXVVVVAAAALLLL.  ppppggggmmmm____ppppbbbbmmmmmmmmaaaaxxxxvvvvaaaallll    is the maxval used when    a PGM
  25.       program reads    a PBM file.  Normally it is 1; however,    for
  26.       some programs, a larger value    gives better results.
  27.  
  28.       #define PGM_FORMAT ...
  29.       #define RPGM_FORMAT ...
  30.       #define PGM_TYPE PGM_FORMAT
  31.       int PGM_FORMAT_TYPE( int format )
  32.  
  33.       For distinguishing different file formats and    types.
  34.  
  35.     IIIINNNNIIIITTTTIIIIAAAALLLLIIIIZZZZAAAATTTTIIIIOOOONNNN
  36.       void pgm_init( int* argcP, char* argv[] )
  37.  
  38.       All PGM programs must    call this routine.
  39.  
  40.     MMMMEEEEMMMMOOOORRRRYYYY MMMMAAAANNNNAAAAGGGGEEEEMMMMEEEENNNNTTTT
  41.       gray** pgm_allocarray( int cols, int rows )
  42.  
  43.       Allocate an array of grays.
  44.  
  45.       gray*    pgm_allocrow( int cols )
  46.  
  47.       Allocate a row of the    given number of    grays.
  48.  
  49.       void pgm_freearray( gray** grays, int    rows )
  50.  
  51.       Free the array allocated with    ppppggggmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) containing
  52.       the given number of rows.
  53.  
  54.       void pgm_freerow( gray* grayrow )
  55.  
  56.       Free a row of    grays.
  57.  
  58.     RRRREEEEAAAADDDDIIIINNNNGGGG    FFFFIIIILLLLEEEESSSS
  59.       void pgm_readpgminit(    FILE* fp, int* colsP, int* rowsP, gray*    maxvalP, int* formatP )
  60.  
  61.  
  62.  
  63.  
  64.      Page 1                         (printed 8/31/98)
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.      lllliiiibbbbppppggggmmmm((((3333))))               UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV             lllliiiibbbbppppggggmmmm((((3333))))
  72.  
  73.  
  74.  
  75.       Read the header from a PGM file, filling in the rows,    cols,
  76.       maxval and format variables.
  77.  
  78.       void pgm_readpgmrow( FILE* fp, gray* grayrow,    int cols, gray maxval, int format )
  79.  
  80.       Read a row of    grays into the grayrow array.  Format, cols,
  81.       and maxval were filled in by ppppggggmmmm____rrrreeeeaaaaddddppppggggmmmmiiiinnnniiiitttt(((()))).
  82.  
  83.       gray** pgm_readpgm( FILE* fp,    int* colsP, int* rowsP,    gray* maxvalP )
  84.  
  85.       Read an entire graymap file into memory, returning the
  86.       allocated array and filling in the rows, cols    and maxval
  87.       variables.  This function combines ppppggggmmmm____rrrreeeeaaaaddddppppggggmmmmiiiinnnniiiitttt(((()))),
  88.       ppppggggmmmm____aaaallllllllooooccccaaaarrrrrrrraaaayyyy(((()))) and ppppggggmmmm____rrrreeeeaaaaddddppppggggmmmmrrrroooowwww(((()))).
  89.  
  90.     WWWWRRRRIIIITTTTIIIINNNNGGGG    FFFFIIIILLLLEEEESSSS
  91.       void pgm_writepgminit( FILE* fp, int cols, int rows, gray maxval, int    forceplain )
  92.  
  93.       Write    the header for a portable graymap file.     The
  94.       forceplain flag forces a plain-format    file to    be written, as
  95.       opposed to a raw-format one.
  96.  
  97.       void pgm_writepgmrow(    FILE* fp, gray*    grayrow, int cols, gray    maxval,    int forceplain )
  98.  
  99.       Write    a row from a portable graymap.
  100.  
  101.       void pgm_writepgm( FILE* fp, gray** grays, int cols, int rows, gray maxval, int forceplain )
  102.  
  103.       Write    the header and all data    for a portable graymap.     This
  104.       function combines ppppggggmmmm____wwwwrrrriiiitttteeeeppppggggmmmmiiiinnnniiiitttt(((()))) and ppppggggmmmm____wwwwrrrriiiitttteeeeppppggggmmmmrrrroooowwww(((()))).
  105.  
  106.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  107.       libpbm(3), libppm(3),    libpnm(3)
  108.  
  109.      AAAAUUUUTTTTHHHHOOOORRRR
  110.       Copyright (C)    1989, 1991 by Tony Hansen and Jef Poskanzer.
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.      Page 2                         (printed 8/31/98)
  131.  
  132.  
  133.  
  134.